#include "stdafx.h"
#include "Card.h"
#include"Entity.h"
#include"Map.h"
CardInvalid CardInvalid::instance;

Card::Card(CardType card_type) :type(card_type)
{
}


Card::~Card()
{
}

bool Card::IsValid()
{
	return true;
}

std::wstring Card::GetDescribe()
{
	return describe;
}

std::wstring Card::GetName()
{
	return name;
}

Card::Demand Card::GetUseDemand(Map & map, Entity & entity)
{
	return{ DemandType::none, 0, 0, 0, 0 };
}

EventResult Card::OnUse(Map & map, Entity & user, Entity & aim, MapBlockPos pos)
{
	if (!aim.IsValid())return OnUse(map, user, pos);
	if (&user == &aim)return OnUse(map, user);
	return OnUse(map, user, aim);
}

EventResult Card::OnGet(Map & map, Entity & entity)
{
	return et_success;
}

EventResult Card::OnLose(Map & map, Entity & entity)
{
	return et_success;
}

EventResult Card::OnUse(Map & map, Entity & user)
{
	return et_success;
}

EventResult Card::OnUse(Map & map, Entity & user, Entity & aim)
{
	return et_success;
}

EventResult Card::OnUse(Map & map, Entity & user, MapBlockPos pos)
{
	return et_success;
}

void Card::OnDraw(Graphic & gfx)
{

}

Card::Demand Card::GetDemandIn(DemandType type, Entity & entity, int n)
{
	LOGIC_AXIS x = entity.GetX() + BLOCK_SIZE * 0.5f;
	LOGIC_AXIS y = entity.GetY() + BLOCK_SIZE * 0.5f;
	return{ type, (int)(x - BLOCK_SIZE*n - BLOCK_SIZE * 0.5f), (int)(y - BLOCK_SIZE*n - BLOCK_SIZE * 0.5f),(int)( x + BLOCK_SIZE*n + BLOCK_SIZE * 0.5f), (int)(y + BLOCK_SIZE*n + BLOCK_SIZE * 0.5f) };
}